<?php
$q1 = "SELECT * FROM code WHERE id = '1' LIMIT 1";
$q1_overzicht = mysql_query($q1) or die ("Er zijn problemen met de database server.");
$q1_result = mysql_fetch_assoc($q1_overzicht);
do {
	$last_time = $q1_result['update_time'];
} while ($q1_result = mysql_fetch_assoc($q1_overzicht));

$current_time = time();

$current_time_min = $current_time - 30;
if ($last_time >= $current_time_min){
	// Don't do anything...
} else {
	$xml_data = file_get_contents('http://api.twitter.com/1/statuses/user_timeline/'.$twittername.'.xml');
	$xml_data = base64_encode($xml_data);
	
	mysql_query("update `code` set `content`='".$xml_data."', `update_time`='".$current_time."' where `id`='1';");
}
?>